package com.lin.springbootthymeleaf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class ThymeleafController {

    @GetMapping("/hello")
    public String hello(@RequestParam String name, Model model,
                        @RequestParam boolean isCat) {
        // 设置模型数据
        model.addAttribute("name", name);
        model.addAttribute("HTMLCode", "<a href=\"https://www.baidu.com\"> 这是一个链接 </a>");
        model.addAttribute("websiteName", "QQ");
        model.addAttribute("websiteURL", "https://www.qq.com");
        model.addAttribute("style" , "color:purple;");
        model.addAttribute("isCat" , isCat);
        model.addAttribute("imgLocation", "/cat1.png");
        return "hello";
    }
}
